package gamebackend;


import framework.Color;
import framework.GraphicsWrapper;

public class PowerUpPredictor {
	private static final int HEIGHT = 20;
	private static final int DIAMETER = 10;
	private final PowerUp my_powerUp;
	private final Color my_color;
	private final double my_start;
	final int my_width;
	public PowerUpPredictor(final PowerUp the_powerUp,
			final int the_width, final Color the_color) {
		my_powerUp = the_powerUp;
		my_color = the_color;
		my_start = my_powerUp.getY();
		my_width = the_width;
	}
	public void step(final int timeDelta) {
		
	}
	public void render(final GraphicsWrapper g) {
		g.setColor(my_color);
		double width = my_width * (my_powerUp.getY() / my_start);
		double height = HEIGHT * ((my_start - my_powerUp.getY()) / my_start) + DIAMETER;
		g.fillRect((int) (my_powerUp.getX() * (my_start - my_powerUp.getY()) / my_start),
				-DIAMETER, (int) width, (int)height);//, DIAMETER, DIAMETER); // TODO used to be roundRect but don't care
	}
	public boolean isAlive() {
		return my_powerUp.getY() < 0;
	}

}
